#include "cmodel.h"

#define _load_feature_map_from_file(t, p) load_feature_map_from_file(t, "txt_param/"p)

int main(int argc, char const *argv[])
{
    featureMap img, img_out_py;
    kernel ker;
    int len;
    float err;

    debug("---------------------------------------------------------------------------------------\n");
    _load_feature_map_from_file(&img, "img_avg_pool2d_test.txt");
    _load_feature_map_from_file(&img_out_py, "out_avg_pool2d_test.txt");

    debug("avg_pool2d test\t");
    debug("img:[%d,%d,%d]\t",img.channels, img.width, img.height);
    avg_pool2d_4x4_inplace(&img);
    debug("img_out:[%d,%d,%d]\n",img.channels, img.width, img.height);
    err = 0.0;

    len = img.channels *img.width * img.height;
    for (int i = 0; i < len; i++)
    {
        err += POW2(img.data[i] - img_out_py.data[i]);
    }
    debug("err:%f\n", err);
    save_feature_map_to_file(img, "img_out_c.txt");

    return 0;
}
